/**
 * 总结算窗口
 */
class TotleSettleWindow extends how.module.Window {
	public header_0: eui.Image;
	public nickname_0: eui.Label;
	public score_0: eui.Label;
	public header_1: eui.Image;
	public nickname_1: eui.Label;
	public score_1: eui.Label;
	public header_2: eui.Image;
	public nickname_2: eui.Label;
	public score_2: eui.Label;
	public header_3: eui.Image;
	public nickname_3: eui.Label;
	public score_3: eui.Label;

	public roomID: eui.Label;
	public backButton: how.Button;

	//scores
	public constructor() {
		super();
		this.skinName = "TotleSettleWindowSkin";
	}
	public start(): void {
		this.roomID.text = "X级房";
		this.backButton.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
			console.log(">>> TotleSettleWindow start 返回");
		}, this);
	}

	public setData(d: any): void {
		let gs:MJGameSceneView = <MJGameSceneView>D.App.gameView;
		for (var i = 0; i < 4; i++) {
			(this["header_" + i] as eui.Image).source = (<MJPlayerView>gs.playerList[i]).head.source;
			(this["nickname_" + i] as eui.Label).text = (<MJPlayerView>gs.playerList[i]).nickNameLabel.text;
			var score = (this["score_" + i] as eui.Label);
			score.text = d.scores[i].toString();
			if (d.scores[i] >= 0) {
				score.textColor = 0x04D035;
			} else {
				score.textColor = 0xF8322D;
			}
		}
	}
}